import React, { Component } from 'react'
import './index.css';
import axios from 'axios';

export default class DouYinDetail extends Component {

    state = {
        detail: {}
    }
    
    render() {
        return (
            <div className="douyin-detail-container">
                <h3>{this.state.detail.desc}</h3>
                <div className="video">
                    <video controls src={"http://cdn.xiaohigh.com" + this.state.detail.video_local}></video>
                </div>
            </div>
        )
    }

    async componentDidMount(){
        //设置 id
        let id = 26;
        //获取当个视频的详细内容
        let {data} = await axios('http://api.xiaohigh.com:8090/douyin/' + id);
        //保存数据进 state
        this.setState({
            detail: data
        })
    }
}
